Using Slicing to Identify Duplication in Source Code

نویسندگان

  • Raghavan Komondoor
  • Susan Horwitz
چکیده

Programs often have a lot of duplicated code, which makes both understanding and maintenance more difficult. This problem can be alleviated by detecting duplicated code, extracting it into a separate new procedure, and replacing all the clones (the instances of the duplicated code) by calls to the new procedure. This paper describes the design and initial implementation of a tool that finds clones and displays them to the programmer. The novel aspect of our approach is the use of program dependence graphs (PDGs) and program slicing to find isomorphic PDG subgraphs that represent clones. The key benefits of this approach are that our tool can find non-contiguous clones (clones whose components do not occur as contiguous text in the program), clones in which matching statements have been reordered, and clones that are intertwined with each other. Furthermore, the clones that are found are likely to be meaningful computations, and thus good candidates for extraction.

برای دانلود متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

منابع مشابه

Detection of Non Continguous Clones in Software using Program Slicing

Code duplication or copying a code fragment and then reuse by pasting with or without any modifcations is a well known code smell in software maintenance. Several studies show that about 5% to 20% of a software systems can contain duplicated code,which is basically the results of copying existing code fragments and using then by pasting with or without minor modifcations. Software cloning is co...

متن کامل

Detecting Refactorable Clones by Slicing Program Dependence Graphs

Code duplication in a program can make understanding and maintenance difficult. The problem can be reduced by detecting duplicated code, refactoring it into a separate procedure, and replacing all the clones by appropriate calls to the new procedure. In this paper, we report on a confirmatory replication of a tool that was used to detect such refactorable clones based on program dependence grap...

متن کامل

And Now For Something Completely Different

A pilot experiment was conducted at Dagstuhl using the ’Beyond program slicing’ seminar attendees. Attendees were split into three groups: all were given the same program to understand and a list of program comprehension related questions to answer. Group one had only the source code, group two had the source code and the dynamic trace of the program, group three had the source and a control-fl...

متن کامل

Slicing Software Architectures

This paper introduces a new form of slicing, named architectural slicing, to aid architectural understanding and reuse. In contrast to traditional slicing, architectural slicing is designed to operate on the architectural description of a software system, rather than the source code of a program. Architectural slicing provides knowledge about the high-level architecture of a software system, ra...

متن کامل

Slicing Software for Model Construction

Applying nite state veri cation techniques e g model check ing to software requires that program source code be trans lated to a nite state transition system that safely models program behavior Automatically checking such a transition system for a correctness property is typically very costly thus it is necessary to reduce the size of the transition sys tem as much as possible In fact it is oft...

متن کامل

ذخیره در منابع من


  با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید

برای دانلود متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

عنوان ژورنال:

دوره   شماره 

صفحات  -

تاریخ انتشار 2001